import React, { Component } from "react";

class Pagejia extends Component {
  render() {
    return <div>甲页面</div>;
  }
}
class Pageyi extends Component {
  render() {
    return <div>乙页面</div>;
  }
}

function Gaojie(Zujian) {
  return class extends Zujian {
    state = {
      shenfen: "",
    };
    componentDidMount() {
      setInterval(() => {
        this.setState({
          shenfen: "龙帝",
        });
      }, 3000);
    }
    render() {
      if (this.state.shenfen === "龙帝") {
        return <Zujian></Zujian>;
      } else {
        return <h3>非龙帝，请出示帝令</h3>;
      }
    }
  };
}

export default class App extends Component {
  render() {
    let Jia = Gaojie(Pagejia);
    let Yi = Gaojie(Pageyi);

    return (
      <div>
        <Jia></Jia>
        <Yi></Yi>
      </div>
    );
  }
}
